<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	
</body>
<script type="text/javascript">
	// 10万个1~1W  数组。
 	// 统计每个数出现的次数。
 	var arr=[];
 	function rand(min,max){
 		return parseInt(Math.random()*(max-min)+min);
 	}
	for(var i = 0; i < 10000; i++){
		arr.push(rand(50,100));
		var count = 0;
		for(var j = 0; j < 100000; j++){
			if (arr[j] == i) {
				count++;
			}
		}
		console.log(i + "出现了" + count + "次");
	}

	var counts = []
	for(var i = 0; i < 10000; i++){
		counts[i] = 0;
	}
	for(var i = 0; i < 100000; i++){
		counts[arr[i]] ++;
	}
</script>
</html>